from flask import session,g
from models.user import UserModel


def get_current_user():
    if not hasattr(g,'user') and "user_id" in session:
        user = UserModel.query.get(session.get("user_id"))
        setattr(g,'user',user)

